﻿using Lidgren.Network;
using Paintball.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Paintball.Abstraction
{
    public class PaintballClient : ClientAgent
    {
        //Fields

        //ctor
        public PaintballClient()
        {

        }

        //Methods
        public override void InitalizeServer()
        {
            SendDiscoverMessage(SafePort);
        }
        protected override void CreateConfig(NetPeerConfiguration config)
        {

        }

        protected override void HandleMessage(NetIncomingMessageType type, Lidgren.Network.NetIncomingMessage msg)
        {
            switch (type)
            {
                case NetIncomingMessageType.DiscoveryResponse:
                    DefaultDiscoveryRequestResponseHandler(msg);
                    break;

                case NetIncomingMessageType.StatusChanged:
                    {
                        NetConnectionStatus s = (NetConnectionStatus)msg.ReadByte();
                        if (s == NetConnectionStatus.Connected)
                        {
                            //We conencted :)

                        }
                        break;
                    }
                default:
                    break;
            }
        }
        protected override void HandleUnhandledDataMessage(Lidgren.Network.NetIncomingMessage msg)
        {

        }

    }
}
